Skip to content

fix: retune defensive precision followups - #83

Merged
alxxjohn merged 3 commits into
mainfrom
fix/defensive-precision-followup
Jul 28, 2026
Merged

fix: retune defensive precision followups#83
alxxjohn merged 3 commits into
mainfrom
fix/defensive-precision-followup

Conversation

@alxxjohn

Copy link
Copy Markdown
Contributor

Summary

This PR retunes the next batch of CodeGuard precision false positives from TypeScript/JavaScript API and integration code. The goal is to keep the production-readiness checks useful while avoiding noisy findings for patterns that are already bounded, typed, or intentionally surfaced to callers.

What changed

  • Retuned defensive.integer-overflow.

    • Stops treating count + 1 external ID allocation as numeric overflow.
    • Skips seed/script paths and date/count formatting arithmetic.
    • Keeps actual unsafe size arithmetic covered.
  • Refined defensive.sequence-collision-risk.

    • count + 1 external ID allocation is now reported under sequence-collision risk instead of integer overflow.
    • Bounded Prisma P2002 / unique-collision retry is treated as mitigation, not full resolution.
    • Retry-mitigated cases emit a lower-confidence architectural-debt warning recommending a database sequence, UUID, or transactional allocator.
  • Retuned defensive.bounds-assumption.

    • Narrows the rule to sequence-like indexing.
    • Avoids dictionary/object/env access such as fieldMap[name] and process.env[name].
  • Retuned defensive.missing-resource-limit.

    • Credits Prisma take.
    • Credits bounded constants and pre-formData() content-length helper guards.
    • Keeps truly unbounded request/form reads covered.
  • Retuned function.inconsistent-return-contract.

    • Allows parser, lookup, read, resolve, and extraction helpers with explicit nullable contracts such as T | null.
    • Allows exists() true/false contracts.
    • Corrects return false so it is no longer treated as an empty return.
  • Retuned error.partial-failure-hidden.

    • Allows digest/fetch loops that append diagnostics/errors/failures and return those diagnostics to callers.
    • Keeps silent catch/continue paths covered.
  • Updated user-facing metadata.

    • Updated rule catalog, fix-template guidance, and docs/checks.md for the retry-mitigated sequence-debt behavior.

Tests

  • Added regression coverage for retry-wrapped external ID allocation.
  • Added regression coverage for seed/script and date bucket arithmetic.
  • Added regression coverage for dictionary/env indexing vs array indexing.
  • Added regression coverage for Prisma take and pre-formData() content-length helper guards.
  • Added regression coverage for nullable parser/lookup/exists return contracts.
  • Added regression coverage for surfaced diagnostics vs hidden partial failures.

Validation

  • Focused regression tests
  • go test ./tests/checks -count=1
  • go test ./...
  • golangci-lint run
  • make codeguard-ci

@alxxjohn
alxxjohn merged commit ef6111a into main Jul 28, 2026
16 checks passed
@alxxjohn
alxxjohn deleted the fix/defensive-precision-followup branch July 28, 2026 17:04
alxxjohn added a commit that referenced this pull request Jul 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.3.6](v1.3.5...v1.3.6)
(2026-07-28)


### Bug Fixes

* report retry-mitigated sequence debt
([8c7a6d5](8c7a6d5))
* retune defensive precision followups
([a9367ae](a9367ae))
* retune defensive precision followups
([#83](#83))
([ef6111a](ef6111a))
* treat allocators as command style
([4d7dfa9](4d7dfa9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant